<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/white/common/common.jsp"%>
<%@include file="/white/common/taglibs.jsp"%>
<html>
	<head>
		<script type="text/javascript">

        function validateAdd() {
        	var url = ""

			url = "prodGroupAction!toAdd.action";

			openWindow(url, 850, 700);
        }
                function toOrder() {
        	var url = ""

			url = "prodGroupAction!toOrder.action";

			openWindow(url, 1050, 700);
        }
        
        function submitForm(){
            var searchForm=document.getElementById("searchForm");
            searchForm.submit();
        }
        
        function notAllowedLockSelf(id){           
            var searchForm=document.getElementById("searchForm");
            searchForm.action="userAction-"+id+"!lock.action";
            searchForm.submit();            
        }
        
        function validateModify(){        	
        	var check = document.getElementsByName("selectedIds");
        	var a = 0;
            var id;
           
            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a++;
                    id = check[i].value;
                }
            }
            
            if(a == 1){  
            	var url = "" 
            	         	
            	var searchForm=document.getElementById("searchForm");
            	
            	url = "prodGroupAction-"+id+"!toEdit.action";
            	
            	openWindow(url,850,500);
            }else{
                alert("请先选择一条记录!!");
            }
        }
        
        function validateModifyQuantity(){
        	var check = document.getElementsByName("selectedIds");
        	var a = 0;
            var id;
           
            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a++;
                    id = check[i].value;
                }
            }
            
            if(a == 1){  
            	var url = "" 
            	         	
            	var searchForm=document.getElementById("searchForm");
            	
            	url = "prodGroupAction-"+id+"!toQuantity.action";
            	
            	openWindow(url,850,500);
            }else{
                alert("请先选择一条记录!!");
            }
        }
        
        function validateDelete(){
            var check=document.getElementsByName("selectedIds");
            var a=false;
            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a=true;
                    break;
                }
            }
            if(a){
                return confirm('你确定删除所选内容??');
            }else{
                alert("请先择你要删除的内容!!");
                return false;
            }
        }

        function doDelete(){
            var searchForm=document.getElementById("searchForm");
            searchForm.action='prodGroupAction!delete.action';
            searchForm.submit();
            return true;
        }
        
        function displayResult(){
            var result = "<s:property value='result'/>";
            if(result != null && result != ""){
                alert(result);
            }
        }    
            function tosearch(){
            var searchForm=document.getElementById("searchForm");
            searchForm.action='prodGroupAction!queryByPage.action';
            searchForm.submit();
            }
             function tocount(){
            var searchForm=document.getElementById("searchForm");
            searchForm.action='prodGroupAction!count.action';
            searchForm.submit();
            }
        
        function excel(){
            var searchForm=document.getElementById("searchForm");
            searchForm.action='prodGroupAction!exportExcel.action';
            searchForm.submit();
          
            }
     function Count()
{
var searchForm=document.getElementById("searchForm");
            searchForm.action='prodGroupAction!count.action';
             searchForm.target="";
            searchForm.submit();

}        

														
   function showCount()
	{
	var searchForm_query_groupId = $("#searchForm_query_groupId").val();
   	var searchForm_query_tel = $("#searchForm_query_tel").val();
   	var searchForm_query_prodClassCode1 = $("#searchForm_query_prodClassCode1").val();
   	var searchForm_query_prodClassName1 = $("#searchForm_query_prodClassName1").val();
   	var searchForm_query_prodClassCode2 = $("#searchForm_query_prodClassCode2").val();
   	var searchForm_query_prodClassName2 = $("#searchForm_query_prodClassName2").val();
   	var searchForm_query_name1 = $("#searchForm_query_name1").val();
   	var searchForm_query_areaCode = $("#searchForm_query_areaCode").val();
   	var searchForm_query_regionCode = $("#searchForm_query_regionCode").val();
   	var searchForm_query_regionName = $("#searchForm_query_regionName").val();
   	var searchForm_query_cityCode = $("#searchForm_query_cityCode").val();
   	var searchForm_query_cityName = $("#searchForm_query_cityName").val();
   	var searchForm_query_name2 = $("#searchForm_query_name2").val();
   	var searchForm_query_inputEmpCode = $("#searchForm_query_inputEmpCode").val();
   	var searchForm_query_inputTime = $("#searchForm_query_inputTime").val();
   	var searchForm_query_modifyEmpCode = $("#searchForm_query_modifyEmpCode").val();
   	var searchForm_query_modifyTime = $("#searchForm_query_modifyTime").val();
   
   	if(searchForm_query_groupId=="" && searchForm_query_tel=="" && searchForm_query_prodClassCode1==""
   			&& searchForm_query_prodClassName1=="" && searchForm_query_prodClassCode2=="" && searchForm_query_prodClassName2==""
   			&& searchForm_query_name1=="" && searchForm_query_name2=="" && searchForm_query_areaCode=="" 
   			 && searchForm_query_regionCode=="" && searchForm_query_cityName==""
   			&& searchForm_query_regionName=="" && searchForm_query_cityCode=="" && searchForm_query_name2==""
   			&& searchForm_query_modifyTime=="" && searchForm_query_inputEmpCode=="" 
   			&& searchForm_query_inputTime=="" && searchForm_query_modifyEmpCode=="") {
   		alert("需要选择一个条件才能进行统计");
   	}else{
   		var content_Type = "application/x-www-form-urlencoded;charset=UTF-8";
   		jQuery.ajax({
	    		url : 'prodGroupAction!count.action',
	    		type : "POST",
	    		contentType : content_Type,
	    		dataType : "text",
	    		data:{'query_groupId':searchForm_query_groupId,'query_tel':searchForm_query_tel,'query_prodClassCode1':searchForm_query_prodClassCode1,'query_prodClassName1':searchForm_query_prodClassName1,'query_prodClassCode2':searchForm_query_prodClassCode2,'query_prodClassName2':searchForm_query_prodClassName2,'query_name1':searchForm_query_name1,'query_name2':searchForm_query_name2,'query_areaCode':searchForm_query_areaCode,'query_regionCode':searchForm_query_regionCode,'query_cityName':searchForm_query_cityName,'query_regionName':searchForm_query_regionName,'query_cityCode':searchForm_query_cityCode,'query_name2':searchForm_query_name2,'query_modifyTime':searchForm_query_modifyTime,'query_inputEmpCode':searchForm_query_inputEmpCode,'query_inputTime':searchForm_query_inputTime,'query_modifyEmpCode':searchForm_query_modifyEmpCode},
	    		error : function(textStatus, errorThrown) {
	    		},
	    		success : function(html) {
	    			$("#statisticsId").html(html);
	    		}
   		});
   	}
   	
   	
   	
	
	
	
	}

    </script>
	</head>
	<body onload="displayResult()">
		<s:form method="post" action="prodGroupAction!queryByPage.action"
			theme="simple" id="searchForm">
			<div id="div_title">
				<h3>
					产品品牌管理
				</h3>
				<div id="div_search">
					<table>
						<tr>
							<!-- 查询条件 -->
							<td width="80" align="right">
								品牌编号:
							</td>
							<td>
								<s:textfield name="query_groupId" />
							</td>
							<td width="80" align="right">
								电话:
							</td>
							<td>
								<s:textfield name="query_tel" />
							</td>
							<td width="80" align="right">
								一级分类编号:
							</td>
							<td>
								<s:textfield name="query_prodClassCode1" />
							</td>
							<td width="80" align="right">
								一级分类名称:
							</td>
							<td>
								<s:textfield name="query_prodClassName1" />
							</td>							
						</tr>
						<tr>
							<td width="80" align="right">
								二级分类编号:
							</td>
							<td>
								<s:textfield name="query_prodClassCode2" />
							</td>
							<td width="80" align="right">
								二级分类名称:
							</td>
							<td>
								<s:textfield name="query_prodClassName2" />
							</td>
							<td width="80" align="right">
								品牌名称1:
							</td>
							<td>
								<s:textfield name="query_name1" />
							</td>
							<td width="80" align="right">
								区号:
							</td>
							<td>
								<s:textfield name="query_areaCode" />
							</td>							
						</tr>
						<tr>
							<td width="80" align="right">
								地区代码:
							</td>
							<td>
								<s:textfield name="query_regionCode" />
							</td>
							<td width="80" align="right">
								地区名称:
							</td>
							<td>
								<s:textfield name="query_regionName" />
							</td>
							<td width="80" align="right">
								城市代码:
							</td>
							<td>
								<s:textfield name="query_cityCode" />
							</td>
							<td width="80" align="right">
								城市名称:
							</td>
							<td>
								<s:textfield name="query_cityName" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								品牌名称2:
							</td>
							<td>
								<s:textfield name="query_name2" />
							</td>
							<td width="80" align="right">
								输入人:
							</td>
							<td>
								<s:textfield name="query_inputEmpCode" />
							</td>
							<td width="80" align="right">
								输入时间:
							</td>
							<td>
								<s:textfield name="query_inputTime" label="日期"
									onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd', minDate:'1900-01-01',maxDate:''})"></s:textfield>
							</td>
							<td width="80" align="right">								
								修改人:
							</td>
							<td>
							<s:textfield name="query_modifyEmpCode" />								
							</td>
						</tr>
						<tr>
						<td width="80" align="right">
								修改时间:
							</td>
							<td>
								<s:textfield name="query_modifyTime" label="日期"
									onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd', minDate:'1900-01-01',maxDate:''})"></s:textfield>
							</td>
						</tr>
						<!-- 
						<tr>
							<td width="80" align="right">
								DestrictCode:
							</td>
							<td>
								<s:textfield name="query_destrictCode" />
							</td>
							<td width="80" align="right">
								DestrictName:
							</td>
							<td>
								<s:textfield name="query_destrictName" />
							</td>
							<td width="80" align="right">
								Addr:
							</td>
							<td>
								<s:textfield name="query_addr" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								Zip:
							</td>
							<td>
								<s:textfield name="query_zip" />
							</td>
							<td width="80" align="right">
								PyAddr:
							</td>
							<td>
								<s:textfield name="query_pyAddr" />
							</td>
							<td width="80" align="right">
								EngAddr:
							</td>
							<td>
								<s:textfield name="query_engAddr" />
							</td>
							<td width="80" align="right">
								Poix:
							</td>
							<td>
								<s:textfield name="query_poix" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								Poiy:
							</td>
							<td>
								<s:textfield name="query_poiy" />
							</td>
							<td width="80" align="right">
								CustStatus:
							</td>
							<td>
								<s:textfield name="query_custStatus" />
							</td>
							<td width="80" align="right">
								CustTypeCode:
							</td>
							<td>
								<s:textfield name="query_custTypeCode" />
							</td>
							<td width="80" align="right">
								ClassMainId:
							</td>
							<td>
								<s:textfield name="query_classMainId" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								OrgId:
							</td>
							<td>
								<s:textfield name="query_orgId" />
							</td>
							<td width="80" align="right">
								Url:
							</td>
							<td>
								<s:textfield name="query_url" />
							</td>
							<td width="80" align="right">
								Weibo:
							</td>
							<td>
								<s:textfield name="query_weibo" />
							</td>
							<td width="80" align="right">
								Weixin:
							</td>
							<td>
								<s:textfield name="query_weixin" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								Yixin:
							</td>
							<td>
								<s:textfield name="query_yixin" />
							</td>
							<td width="80" align="right">
								Logo:
							</td>
							<td>
								<s:textfield name="query_logo" />
							</td>
							<td width="80" align="right">
								SafeStatus:
							</td>
							<td>
								<s:textfield name="query_safeStatus" />
							</td>
							<td width="80" align="right">
								BxName:
							</td>
							<td>
								<s:textfield name="query_bxName" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								PyName:
							</td>
							<td>
								<s:textfield name="query_pyName" />
							</td>
							<td width="80" align="right">
								EngName:
							</td>
							<td>
								<s:textfield name="query_engName" />
							</td>
							<td width="80" align="right">
								SpName:
							</td>
							<td>
								<s:textfield name="query_spName" />
							</td>
							<td width="80" align="right">
								ProdClassId:
							</td>
							<td>
								<s:textfield name="query_prodClassId" />
							</td>
						</tr>
						<tr>
							<td width="80" align="right">
								ModifyTime:
							</td>
							<td width="80" align="right">
								<s:textfield name="query_modifyTime" label="日期"
									onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd', minDate:'1900-01-01',maxDate:''})"></s:textfield>
							</td>
							<td width="80" align="right">
								ModifyEmpId:
							</td>
							<td>
								<s:textfield name="query_modifyEmpId" />
							</td>
							<td width="80" align="right">
								InputTime:
							</td>
							<td width="80" align="right">
								<s:textfield name="query_inputTime" label="日期"
									onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd', minDate:'1900-01-01',maxDate:''})"></s:textfield>
							</td>
							<td width="80" align="right">
								InputEmpId:
							</td>
							<td>
								<s:textfield name="query_inputEmpId" />
							</td>
						</tr>
							
							<td width="80" align="right">
								Subname1:
							</td>
							<td>
								<s:textfield name="query_subname1" />
							</td>
							<td width="80" align="right">
								Subname2:
							</td>
							<td>
								<s:textfield name="query_subname2" />
							</td>
							<td width="80" align="right">
								Subname3:
							</td>
							<td>
								<s:textfield name="query_subname3" />
							</td>
							<td width="80" align="right">
								Subname4:
							</td>
							<td>
								<s:textfield name="query_subname4" />
							</td>
							<td width="80" align="right">
								TelExt:
							</td>
							<td>
								<s:textfield name="query_telExt" />
							</td>
							<td width="80" align="right">
								FaxFlag:
							</td>
							<td>
								<s:textfield name="query_faxFlag" />
							</td>
							<td width="80" align="right">
								Sb:
							</td>
							<td>
								<s:textfield name="query_sb" />
							</td>
							<td width="80" align="right">
								ListOrder:
							</td>
							<td>
								<s:textfield name="query_listOrder" />
							</td>
							<td width="80" align="right">
								Id:
							</td>
							<td>
								<s:textfield name="query_id" />
							</td>
						 -->
						<tr>
						<td width="80" align="right"><authz:authorize
								ifAnyGranted="OMC_PROD_GROUP">
								<%-- 									<s:submit cssClass="submit_search" value="搜索"
										action="prodGroupAction!queryByPage" /> --%>
								<input type="button" class="submit_search" value="搜索"
									onClick="tosearch();">
							</authz:authorize></td>
						<td align="right"><authz:authorize ifAnyGranted="OMC_PROD_GROUP">
								<input type="button" class="submit_search" value="统计"
									onClick="showCount()" />
							</authz:authorize>
							
							</td>
					</tr>
					</table>					
					<div style="height: 30px;line-height:30px;"><span id="statisticsId" style=" padding-left:20px;"></span></div>
				</div>
			</div>
			<div id="div_button">
				<authz:authorize ifAnyGranted="OMC_PROD_GROUP">
					<input type="button" value="新增"
						onclick="validateAdd();return false;"
						cssClass="input_button" />
				</authz:authorize>
				<authz:authorize ifAnyGranted="OMC_PROD_GROUP">
					<input type="button" value="修改" onclick="validateModify()"
						cssClass="input_button" />
							<input type="button" value="批量修改" onclick="validateModifyQuantity()"
						cssClass="input_button" />
						<input type="button" cssClass="input_button"  value="导出" onClick="excel();document.getElementById('searchForm').action='prodGroupAction!queryByPage.action';"/>
				</authz:authorize>

				<authz:authorize ifAnyGranted="OMC_PROD_GROUP">
					<input type="button" value="删除"
						onclick="if(validateDelete()){doDelete()}" >
				</authz:authorize>
			<authz:authorize ifAnyGranted="OMC_PROD_GROUP">
				<input type="button" value="手工排序"
					onclick="toOrder();return false;" cssClass="input_button" />
			</authz:authorize>
			<%@include file="/white/common/message.jsp"%>
			</div>
			<!--列表 开始 -->
			<table cellpadding="0" cellspacing="0" class="t_list">
				<tr>
				
					<th>
						<input type="checkbox" onclick="selectCheckbox();"
							name="checkbox2" value="checkbox" />
					</th>
					<!--列表头部 -->
					<th>
					序号
					</th>
					<th>
						一级分类编号
					</th>
					<th>
						一级分类名称
					</th>
					<th>
						二级分类编号
					</th>
					<th>
						二级分类名称
					</th>
					<th>
						品牌编号
					</th>
					<th>
						品牌名称1
					</th>
					<th>
						品牌名称2
					</th>
					<th>
						区号
					</th>
					<th>
						电话
					</th>
					<th>
						电话2
					</th>
					<th>
						分机
					</th>
					<th>
						地区代码
					</th>
					<th>
						地区名称
					</th>
					<th>
						城市代码
					</th>
					<th>
						城市名称
					</th>
					<th>
						区代码
					</th>
					<th>
						区名称
					</th>					
					<th>
						地址
					</th>
					<th>
						邮编
					</th>
					<th>
						Poix
					</th>
					<th>
						Poiy
					</th>
					<th>
						Url
					</th>
					<th>
						列名次序
					</th>
					<th>
						微博
					</th>
					<th>
						微信
					</th>
					<th>
						易信
					</th>
					<th>
						状态
					</th>
					<th>
						修改时间
					</th>
					<th>
						修改人
					</th>
					<th>
						输入时间
					</th>
					<th>
						输入人
					</th>
					<!-- 
					
					<th>
						Subname1
					</th>
					<th>
						Subname2
					</th>
					<th>
						Subname3
					</th>
					<th>
						Subname4
					</th>
					<th>
						FaxFlag
					</th>
					<th>
						Sb
					</th>
					<th>
						PyAddr
					</th>
					<th>
						EngAddr
					</th>
					
					<th>
						CustTypeCode
					</th>
					<th>
						ClassMainId
					</th>
					<th>
						OrgId
					</th>
					<th>
						Logo
					</th>
					<th>
						SafeStatus
					</th>
					<th>
						BxName
					</th>
					<th>
						PyName
					</th>
					<th>
						EngName
					</th>
					<th>
						SpName
					</th>
					<th>
						ProdClassId
					</th>
					 -->
				</tr>
				<s:iterator value="resultList" status="sindex">
					<tr>
						<td>
							<input type="checkbox" name="selectedIds"
								value="${ ID }" id="selectedIds" />
						</td>
						<td>
						${sindex.count }
							
						</td>
						<td>
							<s:property value="PROD_CLASS_CODE1" />
						</td>
						<td>
							<s:property value="PROD_CLASS_NAME1" />
						</td>
						<td>
							<s:property value="PROD_CLASS_CODE2" />
						</td>
						<td>
							<s:property value="PROD_CLASS_NAME2" />
						</td>
						<td>
							<s:property value="GROUP_ID" />
						</td>
						<td>
							<s:property value="NAME1" />
						</td>
						<td>
							<s:property value="NAME2" />
						</td>
						<td>
							<s:property value="AREA_CODE" />
						</td>
						<td>
							<s:property value="TEL" />
						</td>
						<td>
							<s:property value="TEL2" />
						</td>
						<td>
							<s:property value="TEL_EXT" />
						</td>
						<td>
							<s:property value="REGION_CODE" />
						</td>
						<td>
							<s:property value="REGION_NAME" />
						</td>
						<td>
							<s:property value="CITY_CODE" />
						</td>
						<td>
							<s:property value="CITY_NAME" />
						</td>
						<td>
							<s:property value="DESTRICT_CODE" />
						</td>
						<td>
							<s:property value="DESTRICT_NAME" />
						</td>
						
						<td>
							<s:property value="ADDR" />
						</td>
						<td>
							<s:property value="ZIP" />
						</td>
						<td>
							<s:property value="POIX" />
						</td>
						<td>
							<s:property value="POIY" />
						</td>
						<td>
							<s:property value="URL" />
						</td>
						<td>
							<s:property value="LIST_ORDER" />
						</td>
						<td>
							<s:property value="WEIBO" />
						</td>
						<td>
							<s:property value="WEIXIN" />
						</td>
						<td>
							<s:property value="YIXIN" />
						</td>
						<td>
							<s:property value="CUST_STATUS" />
						</td>
						<td>
							<s:property value="MODIFY_TIME" />
						</td>
						<td>
							<s:property value="MODIFY_EMP_CODE" />
						</td>
						<td>
							<s:property value="INPUT_TIME" />
						</td>
						<td>
							<s:property value="INPUT_EMP_CODE" />
						</td>
						<!-- 
						<td>
							<s:property value="SUBNAME1" />
						</td>
						<td>
							<s:property value="SUBNAME2" />
						</td>
						<td>
							<s:property value="SUBNAME3" />
						</td>
						<td>
							<s:property value="SUBNAME4" />
						</td>
						<td>
							<s:property value="FAX_FLAG" />
						</td>
						<td>
							<s:property value="SB" />
						</td>
						<td>
							<s:property value="PY_ADDR" />
						</td>
						<td>
							<s:property value="ENG_ADDR" />
						</td>
						<td>
							<s:property value="CUST_STATUS" />
						</td>
						<td>
							<s:property value="CUST_TYPE_CODE" />
						</td>
						<td>
							<s:property value="CLASS_MAIN_ID" />
						</td>
						<td>
							<s:property value="ORG_ID" />
						</td>
						<td>
							<s:property value="LOGO" />
						</td>
						<td>
							<s:property value="SAFE_STATUS" />
						</td>
						<td>
							<s:property value="BX_NAME" />
						</td>
						<td>
							<s:property value="PY_NAME" />
						</td>
						<td>
							<s:property value="ENG_NAME" />
						</td>
						<td>
							<s:property value="SP_NAME" />
						</td>
						<td>
							<s:property value="PROD_CLASS_ID" />
						</td>
						<td>
							<s:property value="ID" />
						</td>
						 -->
					</tr>
				</s:iterator>
			</table>
			<!--列表 结束 -->
			<!--分页 开始 -->
			<s:if test="resultList.size() > 0">
				<table border="0" cellspacing="0" cellpadding="0" class="t_bottom">
					<tr>
						<td><%@include file="/white/common/pageList.jsp"%></td>
					</tr>
				</table>
			</s:if>
			<!--分页 结束 -->

		</s:form>
	</body>
</html>
